Repository navigation
chore(deps): bump commander to 15.1.0 and add CLI tests - #627
Merged
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the Superstatic CLI to support better testability by introducing a createCli factory function that allows overriding dependencies like the server factory, working directory, and environment variables. It also upgrades the commander dependency to version 15.1.0 and adds a comprehensive suite of unit tests. Feedback on these changes includes improving port validation to prevent runtime crashes with invalid port numbers, and moving the server startup log inside the listen callback while dynamically resolving the bound port to handle dynamic port allocation (port 0) correctly.
joehan
approved these changes
Dec 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #582.
Summary
commanderfrom^10.0.0(10.0.1) to^15.1.0(15.1.0).engines.nodefrom22 || 24 || 26to^22.12.0 || 24 || 26to align with Commander 15's ESM-onlyrequire(esm)requirement (>=22.12.0).createCliinsrc/cli/index.ts(preserving the defaultcliexport) so CLI option parsing and.env.jsonhandling can be tested cleanly in isolation.test/unit/cli.spec.tscovering Commander ESM loading from CJS, default and custom CLI flags (including--host/--hostname), invalid port fallback,--version, Commander 13+ excess positional argument rejection,.env.jsonloading, and a real server smoke test.Verification
npm test(eslint+nyc mocha): 365 passing (src/cli/index.tsat 100% statements/functions/lines)npm run build&npm run preparenpm run license:checknpm install --package-lock-only --ignore-scripts --registry=https://registry.npmjs.org(no lockfile diff)lib/bin/server.json Node v24.22.1 and Node v26.12.1